Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch Controls #1104

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from
Open

Touch Controls #1104

wants to merge 16 commits into from

Conversation

Dhruv-0-Arora
Copy link
Collaborator

@Dhruv-0-Arora Dhruv-0-Arora commented Aug 21, 2024

Description

Creating touch controls joysticks for mobile devices. To enable the touch controls, you must be on a device with touch capabilities. When this happens, the Enable touch controls button will appear in the MainHUD.

Screenshot 2024-08-23 at 2 48 12 PM

After enabling the touch controls the controls themselves will appear on screen.

Screenshot 2024-08-23 at 2 49 06 PM

To use them, you must configure a inputscheme or use the preset "Brandon"

Notes

  • In the future we will create a queue of the different actions on the top of the screen that will appear as they are available to execute. For example, intake when there is an object in the intakesensor, eject when needed, and place assembly. These will be based off the design of the place assembly button.
  • When configuring the inputscheme, the useGamepad and useTouchControls checkboxes can be selected at the same time. This is a bug. To fix this, we will need to change the implementation of the Checkbox to utilize the checked={} prop instead of default value.
  • When creating a new configuration and enabling touch controls, the different joint configurations appear (which causes a bug of joints moving as the robot moves). To fix this, we should create a "add joint configuration" button when creating a new configuration.
  • In the future, on the top left of the screen there will be sliders for joints similar to the queue that will appear only if there is a configuration for a joint.

JIRA Issue

@Dhruv-0-Arora Dhruv-0-Arora added the gameplay Relating to the playability of Synthesis label Aug 21, 2024
@Dhruv-0-Arora Dhruv-0-Arora self-assigned this Aug 21, 2024
@Dhruv-0-Arora Dhruv-0-Arora changed the title Dhruv/1847/touch controls Touch Controls Aug 21, 2024
/** @returns {number} a number between -1 and 1 for this input. */
abstract getValue(useGamepad: boolean): number
// Returns the current value of the input. Range depends on input type
abstract getValue(useGamepad: boolean, useTouchControls: boolean): number
Copy link
Collaborator

@LucaHaverty LucaHaverty Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if instead of getValue() taking in useTouchControls and useGamepad, the input scheme stored an enum InputType, replacing the boolean it currently has called useGamepad? That would avoid different input type conditions originating from different places and potentially overriding each other.

export enum InputType {
    KEYBOARD,
    GAMEPAD,
    TOUCH
 }

export type InputScheme = {
    schemeName: string
    descriptiveName: string
    customized: boolean
    inputType: InputType
    inputs: Input[]
}

@@ -18,8 +20,8 @@ abstract class Input {
this.inputName = inputName
}

/** @returns {number} a number between -1 and 1 for this input. */
abstract getValue(useGamepad: boolean): number
// Returns the current value of the input. Range depends on input type
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every input should be between -1 and 1 for consistency

Changes that need to be made:
Only one of the usegamepad and usetouchcontrols checkboxes can be selected at a time
When creating a new scheme you may click an add joint button to add another joint configuration.
@Dhruv-0-Arora Dhruv-0-Arora marked this pull request as ready for review August 23, 2024 21:47
@Dhruv-0-Arora Dhruv-0-Arora requested review from a-crowell and LucaHaverty and removed request for a team August 23, 2024 21:47
Copy link
Collaborator

@LucaHaverty LucaHaverty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, but I have a couple requests and recommendations:

  1. If you aren't on a device that supports touch controls, the touch control scheme should not be selectable because there's not way to control it. If we keep a similar button, consider making it more opaque and blurring the background.
    image

  2. Instead of a button to open touch controls, they should automatically appear if there's a robot spawned that uses them.

  3. The place assembly button text is really hard to read with some backgrounds. It also looks a little out of place. I think this is because the colors and style are so different than the others buttons. Maybe it could appear on the panel that that loading bar is on once it finishes loading?

  4. When I connect to the network version, I get the error Uncaught TypeError: can't access property "getDirectory", navigator.storage is undefined MirabufLoader.ts:29. Is this just me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gameplay Relating to the playability of Synthesis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants